﻿using System.Linq;

using vurfu.DataContracts;
using vurfu.Linq;

namespace vurfu.Repositories
{
    public class StatusRepository
    {
        public Status GetStatus(string statusId)
        {
            Status status;
            using (var connection = DataContextFactory.Create())
            {
                status = (from statuses in connection.GetTable<Status>()
                           where statuses.StatusId == statusId
                           select statuses).First();
            }
            return status;
        }

        public void SaveStatus(Status status)
        {
            using (var connection = DataContextFactory.Create())
            {
                connection.GetTable<Status>().InsertOnSubmit(status);
                connection.SubmitChanges();
            }
        }
    }
}